<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
     <h1>JS</h1>
    <hr>

    <script>
        var num = 556;
        var num = 12e-3;
        var num = 12e3;
        var num = 12e+3;

        // var num = 0b110; // 2进制
        // var num = 010; // 8进制
        // var num = 0xff; // 16进制
        
        console.log(num);
        console.log(typeof num);

        // Not a Number
        var num = NaN;
        console.log(num);

        console.log(NaN + 100);
        if (NaN) {
            console.log(true);
        } else{
            console.log(false);
        }
        if (NaN == NaN) {
            console.log(true);
        } else{
            console.log(false);
        }

        // 把其他值转换成数值时,转成功成为数值,转不成就成 NaN
        // Number()   parseInt()   parseFloat()
        
        var a = 'hhhhhhhh';
        var a = '';
        var a = '55aaa';
        var a = '55.99aaa';
        var a = true;
        var a = false;
        var a = null;
        var a = undefined;

        // var n = Number(a);
        var n = parseInt(a);
        // var n = parseFloat(a);

        console.log(n);
        console.log(typeof n);

        // isNaN()  判断一个值是否是 NaN
        console.log(isNaN(99));
        console.log(isNaN('sdhjkjfdf'));
        console.log(isNaN('66.6sss'));

    </script>   
</body>
</html>
